package com.gf.framework.web.base;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Properties;

/**
 * @author gaofei
 * @date 2022/6/25 15:24
 */
@Api(tags = "环境变量和配置信息")
@RestController
@RequestMapping("env")
@Slf4j
public class EnvironmentController {
    @Autowired
    Environment environment;

    @ApiOperation("环境变量")
    @GetMapping("envmap")
    public Map<String, String> envmap() {
        return System.getenv();
    }

    @ApiOperation("java基础配置")
    @GetMapping("properties")
    public Properties properties() {
        return System.getProperties();
    }
}
